﻿Public Class ReservaNegocio

    Function insertarReserva(ByVal a As Integer, ByVal b As Integer, ByVal c As String, ByVal d As String, ByVal e As String, ByVal f As String)

        Dim modelo As New Reserva()

        modelo.idInmueble = a
        modelo.idEstudiante = b
        modelo.FechaInicio = c
        modelo.FechaFin = d
        modelo.fechaconfirmacion = e
        modelo.TipoPago = f

        Dim dao As New ReservaDAO
        Try
            Return dao.insertar(modelo)
        Catch ex As Exception
            Throw ex
        End Try

    End Function

    Public Sub actualizar(ByVal idReserva As Integer, ByVal FechaInicio As String, ByVal FechaFin As String, ByVal fechaconfirmacion As String, ByVal TipoPago As String)
        'Public Sub actualizar(ByVal idReserva As Integer, ByVal FechaInicio As String, ByVal FechaFin As String, ByVal fechacofirmacion As String, ByVal TipoPago As String)

        Dim modelo As New Reserva()
        modelo.idReserva = idReserva
        modelo.FechaInicio = FechaInicio
        modelo.FechaFin = FechaFin
        modelo.fechaconfirmacion = fechaconfirmacion
        modelo.TipoPago = TipoPago

        Dim dao As New ReservaDAO
        dao.actualizar(modelo)
    End Sub

    Public Function obtener(ByVal idReserva As Integer) As Reserva
        Dim dao As New ReservaDAO
        Return dao.obtener(idReserva)
    End Function

    Public Function listar() As Collection
        Dim dao As New ReservaDAO
        Return dao.listar()
    End Function

    'Public Function buscarPorNombre(ByVal TipoPago As String) As Collection
    '    Dim dao As New ReservaDAO
    '    Return dao.buscarPorNombre(TipoPago)
    'End Function

    Public Function buscarPorNombre(ByVal TipoPago As String) As Collection
        Dim dao As New ReservaDAO
        Return dao.buscarPorNombre(TipoPago)

    End Function

End Class